<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let result = {
        code: 200,
        state: "ok",
        goodCate: "电子产品",
        goodsList: [
          {
            id: 100012,
            goodsPrice: 6999,
            goodsName: "MateBook",
            goodsCount: 99,
            goodsRank: 1,
            goodsBrand: "HUAWEI",
          },
          {
            id: 100032,
            goodsPrice: 4999,
            goodsName: "Air13",
            goodsCount: 86,
            goodsRank: 3,
            goodsBrand: "XIAOMI",
          },
          {
            id: 100095,
            goodsPrice: 16000,
            goodsName: "MacBookPro",
            goodsCount: 14,
            goodsRank: 2,
            goodsBrand: "Apple",
          },
        ],
      };
      if (result.code === 200) {
        console.log(result.goodCate);
        for (let i = 0; i < result.goodsList.length; i++) {
          console.log(result.goodsList[i]);
          if (result.goodsList[i].goodsName === "Air13") {
            console.log(result.goodsList[i].goodsPrice);
          }
          if (result.goodsList[i].goodsPrice == 16000) {
            result.goodsList[i].tag = "好用、快速、性价比高";
            console.log(result.goodsList[i].tag);
          }
          if (result.goodsList[i].goodsPrice < 10000) {
            let goodsArr = [];
            goodsArr.push(result.goodsList[i].goodsName);
            console.log(`这是${goodsArr}`);
          }
          if (goodsArr.length > 6) {
            console.log(goodsArr.length);
            console.log(goodsArr);
          }
        }
      }
    </script>
  </body>
</html>
